package com.yl.solution.entity;

import java.io.Serializable;
import java.sql.Blob;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity(name = "Unresolved_Problem")
public class Unresolved_Problem implements Serializable {	// 待解决问题表
	
	private static final long serialVersionUID = -4118198793075669896L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, // 使用sequence生成主键
	generator = "generator" // 引用下面名为gernator的生成策略
	)
	@SequenceGenerator(name = "generator", // 定义名为generator的生成策略
	allocationSize = 1, // 每次sequence加1
	sequenceName = "unresolved_problem_seq" // 引用名为Unresolved_Problem_seq的sequence
	)
	@Column(name = "id")
	private int id; // 问题ID

	@Column(name = "title", length = 100)
	private String title; // 问题标题

	@Column(name = "sketch", length = 1000)
	private String sketch; // 问题简述

	@Column(name = "status")
	private int status; // 问题状态0，1，2（0=未解决，1=解决中，2=以解决）

	@Lob
	@Basic(fetch = FetchType.LAZY)
	@Column(name = "problem_image", columnDefinition = "BLOB", nullable = true)
	private Blob problem_image; // 问题图片

	@Temporal(TemporalType.DATE)
	@Column(name = "submitted_time", nullable = false)
	private Date submitted_time; // 解决时间

	@Column(name = "remark", length = 20)
	private String remark; // 门店

	@Column(name = "phone", length = 20)
	private String phone; // 联系电话

	@ManyToOne()
	@JoinColumn(name = "question_type_id")
	private Question_Type question_type; // 问题类型（外键）

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getSketch() {
		return sketch;
	}

	public void setSketch(String sketch) {
		this.sketch = sketch;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Blob getProblem_image() {
		return problem_image;
	}

	public void setProblem_image(Blob problem_image) {
		this.problem_image = problem_image;
	}

	public Date getSubmitted_time() {
		return submitted_time;
	}

	public void setSubmitted_time(Date submitted_time) {
		this.submitted_time = submitted_time;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public Question_Type getQuestion_type() {
		return question_type;
	}

	public void setQuestion_type(Question_Type question_type) {
		this.question_type = question_type;
	}

}
